<?php echo script::add('jquery');?><?php echo $editor_js; ?>
<script type="text/javascript">$(document).ready(function(){
	$('#submit_button').click(function(){
		var title=$('#title_box').val();
		var term=$('#class_box').val();
		var content=KE.html('content_box');
		var author=$('#author_box').val();
		var tag=$('#tag_box').val();
		var keyword=$('#meta_keyword_box').val();
		var description=$('#meta_description').val();
		var type=$('input[name=type_box]:checked').val();
		if(title==''){
			alert('标题不能为空');
			$('input[name=title_box]').focus();
			return false;
		}

		if(term==0){
			alert('请选择文章分类');
			return false;
		}
		if(content==''){
			alert('文章内容不能为空');
			return false;
		}
		$.post('<?php echo $this->get_action_url('ajax_insert_new'); ?>', {title_box:title,content_box:content,author_box:author,class_box:term,type_box:type,tag_box:tag,meta_keyword_box:keyword,meta_description:description}, function(data){
	switch(data){
		case '101':
		alert('文章添加成功!');
		location.href='<?php echo $this->get_action_url('index'); ?>';
		break; 
		case '100':
		alert('文章添加失败!');
		break;
	}
});
	});
});
</script>
<table width="800" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="30" align="left">>><?php echo $site_name; ?></td>
      </tr>
      <tr>
        <td align="left" valign="top"><table width="800" border="0" cellspacing="5" cellpadding="0" style="margin:0px; border:0px; border:none;">
          <tr>
            <td width="100" height="30" align="right">标题：</td>
            <td width="475"><input type="text" name="title_box" id="title_box"/></td>
            <td width="60" align="center">分类:</td>
            <td width="140"><?php echo html::select($class_data, array('name'=>'class_box', 'id'=>'class_box'), 0); ?></td>
          </tr>
          <tr>
            <td width="100" height="420" align="right" valign="top">内容：</td>
            <td colspan="3" align="left" valign="top"><textarea name="content_box" style="width:640px; height:410px;" id="content_box"></textarea></td>
          </tr>
          <tr>
            <td width="100" height="30" align="right">标签：</td>
            <td align="left"><input type="text" name="tag_box" id="tag_box"/><input type="hidden" name="author_box" id="author_box" value="<?php echo $user_id; ?>" /></td>
            <td align="center">类型：</td>
            <td><?php echo html::radio(array('0'=>'公开', '1'=>'私有'), array('name'=>'type_box')); ?></td>
          </tr>
          <tr>
            <td height="30" align="right">keywords ： </td>
            <td height="30" colspan="3" align="left"><input type="text" name="meta_keyword_box" id="meta_keyword_box"/></td>
          </tr>
          <tr>
            <td height="70" align="right">description： </td>
            <td height="30" colspan="3" align="left" valign="top"><textarea name="meta_description" id="meta_description"></textarea></td>
          </tr>
          <tr>
            <td height="30" colspan="4" align="center"><input type="button" name="submit_button" value="提交" id="submit_button"/></td>
          </tr>
        </table></td>
      </tr>
</table>